function OSGBCamera(renderer, camera) {
    this.renderer = renderer;
    this.camera = camera;
    this.frustum = new THREE.Frustum();
    this.projScreenMatrix = new THREE.Matrix4();
}

Object.assign(OSGBCamera.prototype, {

    setCamera: function (camera) {
        this.camera = camera;
    },

    getCamera: function () {
        return this.camera;
    },

    update: function () {
        if (this.camera != null && this.frustum != null) {
            this.projScreenMatrix.multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
            this.frustum.setFromMatrix(this.projScreenMatrix);
        }
    },

    intersectsSphere: function (sphere) {
        if (this.frustum != null && sphere != null) {
            return this.frustum.intersectsSphere(sphere);
        }
        return false;
    },

    intersectsBox: function (box) {
        if (this.frustum != null && box != null) {
            return this.frustum.intersectsBox(box);
        }
        return false;
    },

    clampedPixelSize: function (center, radius, geometricError) {
        var dx = this.camera.position.x - center.x;
        var dy = this.camera.position.y - center.y;
        var dz = this.camera.position.z - center.z;
        var distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
        var sseDenominator = 2.0 * Math.tan(this.camera.fov * (3.141592653 / 180) / 2);
        let size = new  THREE.Vector2(0,0);
        var height = this.renderer.getSize(size).y;
        var pixelSize = geometricError * 2 * radius * height / (distance * sseDenominator);
        return pixelSize;
    },

} );
